<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

include ("../conn/conn.php");
$conn = prepare();

$username = $_POST['username'];
$password1 = $_POST['password1'];
$password2 = $_POST['password2'];
$password3 = $_POST['password3'];

$sql= exectue_sql_statement($conn, "select * from Users where users_name='$username'");
$info=sqlsrv_fetch_array($sql);
if($info['users_password']!=$password1){
 echo"<script>alert('管理员密码不正确!');window.location.href='changeadminpwd.php';</script>";
exit;
}

exectue_sql_statement($conn, 
                      "update Users set users_password='$password2' where users_name='$username'"
                     );
echo "<script>alert('管理员".$username."密码修改成功!');window.location.href='changeadminpwd.php';</script>";

?>